package com.mes.cloud.util;

import org.springframework.util.CollectionUtils;

import java.util.HashSet;
import java.util.Set;

/**
 * @Description TODO
 * @author: wxm
 * @date: 2019/9/25 15:14
 * @version: 1.0
 */
public class CommonUtil {

    /**
     * existIdList  idList中元素做比较,返回idList中不存在existIdList中的id
     *
     * @param existIdList
     * @param idList
     * @return
     */
    public static Set<String> deleteExistId(Set<String> existIdList, Set<String> idList) {
        if(CollectionUtils.isEmpty(existIdList)){
            return idList;
        }
        Set<String> returnList = new HashSet<>();
        for (String id : idList) {
            //判断id是否存在existIdList列表中
            if (!existIdList.contains(id)) {
                returnList.add(id);
            }
        }
        return returnList;
    }
}
